package windowUnits;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import windows.NewArticle;

import com.swtdesigner.SwingResourceManager;

public class ActionButtonPane extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private final JButton button = new JButton();
	private String buttonText = "Preview";
	private String buttonIcon = "Preview Docment.png";
	private final int x_size = 60;

	/**
	 * Create the panel
	 */
	public ActionButtonPane() {
		super();
		try {
			jbInit();
		} catch (Throwable e) {
			e.printStackTrace();
		}
		//
	}
	private void jbInit() throws Exception {
		setPreferredSize(new Dimension(x_size, 51));
		setLayout(null);
		setMinimumSize(new Dimension(x_size, 51));
		setMaximumSize(new Dimension(x_size, 51));
		
		add(button);
		button.setIconTextGap(0);
		button.setBounds(0, 0, x_size, 51);
		button.setPreferredSize(new Dimension(x_size, 51));
		button.setMinimumSize(new Dimension(x_size, 51));
		button.setMaximumSize(new Dimension(x_size, 51));
		button.setFont(new Font("Courier",Font.BOLD,10));
		button.setForeground(new Color(11,85,196));
		button.setText(buttonText);
		button.setVerticalTextPosition(SwingConstants.BOTTOM);
		button.setHorizontalTextPosition(SwingConstants.CENTER);
		button.setMargin(new Insets(2, 0, 0, 0));
		button.setIcon(SwingResourceManager.getIcon(NewArticle.class, "/icons/"+buttonIcon));
	}
	
	public void setButtonAction(ActionListener ac){
		button.addActionListener(ac);
	}
	
	public JButton getButton(){
		return button;
	}
	
}
